EmergencyExerciseView=Ext.extend(Ext.Panel,{
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        EmergencyExerciseView.superclass.constructor.call(this, {
            id:'EmergencyExerciseView',
            title:'应急预案',
            layout:'border',
            border:false,
            region:'center',
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel,all.yearGridTreePanel]
            
        });
    },
    initUIComponents:function(){
        var yearGridComponents=new createyeargridview({
            topbar : {
                inputFormName : 'EmergencyExerciseForm',
                topbarAdd:{
                    hidden:false
                },
                topbarDel:{
                    hidden:false
                }
            },
            search : {
                items : [ {
                    style : "margin:5px 5px 5px 5px;",
                    text : "预案编号"
                }, {
                    columnWidth : 0.2,
                    xtype : "textfield",
                    name : "Q_emergencyNo_S_LK",
                    maxLength : 256
                } ]
            },
            grid : {
                title : "应急预案列表",
                rowActions:true,
                listUrl : __ctxPath + "/emergency/listEmergencyExercise.do",
                removeUrl : __ctxPath + "/emergency/deleteEmergencyExercise.do",
                fields : [ "id", 'years','institution','emergencyNo', "emergencyName", "emergencyKeyPlace", "coverPost","hazardSourceName","emergencyContactMode","rescueTeam"],
                columns : [ {
                    header : "id",
                    dataIndex : "id",
                    hidden : true
                }, {
                    header : "年份",
                    dataIndex : "years",
                    width : 50,
                    hidden:true,
                    sortable : true
                }, {
                    header:"所属机构",
                    dataIndex:'institution',
                    width:100
                },{
                    header : "预案编号",
                    dataIndex : "emergencyNo",
                    width : 100
                }, {
                    header : "预案名称",
                    dataIndex : "emergencyName",
                    width : 70
                }, {
                    header : "关键场所",
                    dataIndex : "emergencyKeyPlace",
                    width : 100
                }, {
                    header:"覆盖岗位",
                    dataIndex:"coverPost",
                    width:100
                }, {
                    header : "危险源名称",
                    dataIndex : "hazardSourceName",
                    width : 70
                },{
                    header:'应急联系方式',
                    dataIndex:'emergencyContactMode',
                    width:70
                },{
                    header:'救援队伍',
                    dataIndex:'rescueTeam',
                    width:70
                },{
                    header:'评审信息',
                    dataIndex:'emgExerciseReviewId',
                    sortable:false,
                    width:50,
                    renderer:function(value,metadata,record,rowIndex,colIndex){
                        var cfg={
                                emergencyId:record.data.id,
                                emergencyNo:record.data.emergencyNo,
                                emergencyName:record.data.emergencyName
                        }
                        var k = "";
                        k += '<button title="评审" value="" class="btn-showDetail" onclick=\'EmergencyExerciseView.pingShenXinXi('
                            + JSON.stringify(cfg) + ')\'></button>';
                        return k;
                    }
                }]
            },
            tree : {
                treeUrl : __ctxPath + "/emergency/treeLoadEmergencyExercise.do"
            }
        });
        return yearGridComponents;
    }
});

EmergencyExerciseView.pingShenXinXi=function(emergency){
    new EmergencyExerciseReviceWindow({
        emergencyId : emergency.emergencyId,
        emergencyNo: emergency.emergencyNo,
        emergencyName: emergency.emergencyName
    }).show();
}